package com.tz.crm.entity;

import javax.persistence.*;

/**
 * 模板属性
 */
@Entity
@Table(name = "tbl_property")
public class Property extends BaseEntity {

    private static final long serialVersionUID = 2506418151081484694L;
    private String name;//名
    private TypeIn typeIn;//录入方式
    private String list;//列表选择
    private int seq;//排序号
    private Contract contract;//
    private ContractTemplate contractTemplate;//属于那个模版

    /**
     * 空参构造
     */
    public Property() {
    }

    /**
     * 有参构造
     *
     * @param typeIn           录入方式
     * @param list             列表选择
     * @param contractTemplate contractTemplate
     * @param name             名
     * @param seq              排序
     */
    public Property(TypeIn typeIn, String list, ContractTemplate contractTemplate, String name, int seq) {
        this.typeIn = typeIn;
        this.list = list;
        this.contractTemplate = contractTemplate;
        this.name = name;
        this.seq = seq;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Enumerated(EnumType.STRING)
    public TypeIn getTypeIn() {
        return typeIn;
    }

    public void setTypeIn(TypeIn typeIn) {
        this.typeIn = typeIn;
    }

    public String getList() {
        return list;
    }

    public void setList(String list) {
        this.list = list;
    }

    @ManyToOne
    @JoinColumn(name = "contract_id")
    public Contract getContract() {
        return contract;
    }

    public void setContract(Contract contract) {
        this.contract = contract;
    }

    @ManyToOne
    @JoinColumn(name = "contract_template_id")
    public ContractTemplate getContractTemplate() {
        return contractTemplate;
    }

    public void setContractTemplate(ContractTemplate contractTemplate) {
        this.contractTemplate = contractTemplate;
    }

    public int getSeq() {
        return seq;
    }

    public void setSeq(int seq) {
        this.seq = seq;
    }

    @Override
    public String toString() {
        return "Property{" +
                ", name='" + name + '\'' +
                ", typeIn=" + typeIn +
                ", list='" + list + '\'' +
                ", seq=" + seq +
                '}';
    }

    /**
     * 录入方式枚举
     */
    public enum TypeIn {
        pickFromList,
        writeByHand,
        checkBoxList
    }

}
